import {ConfigProvider, theme} from "antd"
import AppRouter from "./router/AppRouter.tsx"
import zhCN from 'antd/locale/zh_CN'
import React from "react"
import {message} from "antd"
import {useMessageApiStore} from "@/store/BaseStore.ts"
import {setMessageApi} from "@/utils/ApiUtil.ts";
const App:React.FC  = ()=> {
    const [messageApi, contextHolder] = message.useMessage()
    useMessageApiStore((state) => state.setMessageApi)(messageApi)
    setMessageApi(messageApi); // 设置进行网络请求时对请求结果的消息提示
    return (
        <ConfigProvider
            theme={
                {
                    algorithm: theme.darkAlgorithm,
                    token: {
                        colorPrimary: "#7462ff",
                        colorBgBase: "#212326"
                    }
                }
            }
            locale={zhCN}
        >
            <AppRouter/>
            {contextHolder}
        </ConfigProvider>
    )
}

export default App;
